<p>
Total Count: <%= Intrigue::Model::TaskResult.scope_by_project(@project_name).all.count %><br/>
Selected Count: <%= @result_count %><br/>
</p>

<div class="col-sm-2">
  <form class="form-horizontal" id="result_search" target="_self" method="get" action="/<%=@project_name%>/results">

    Search:
    <input type="text" style='width:100%' class="form-control sm" id="search_string" name="search_string">
    <input id="inverse" name="inverse" type="checkbox"> Inverse <br/>
    <br/><br/>
    <input id="hide_cancelled" name="hide_cancelled" type="checkbox"> Hide Cancelled <br/>
    <input id="hide_enrichment" name="hide_enrichment" type="checkbox"> Hide Enrichment <br/>
    <input id="hide_autoscheduled" name="hide_autoscheduled" type="checkbox"> Hide Autoscheduled <br/>
    <input id="only_complete" name="only_complete" type="checkbox"> Only Complete <br/>
    <input class="btn btn-primary" type="submit" value="Search">
  </form>

</div>

<div class="col-sm-10">
  <%= "Page: #{@page}" %>
  <%= "Results: #{@result_count * (@page-1)} .. #{@result_count * @page-1}" %>
  <a href="<%=request.path%>?page=<%=@page-1%>&search_string=<%=@search_string%>">previous</a>
  <a href="<%=request.path%>?page=<%=@page+1%>&search_string=<%=@search_string%>">next</a>

  <script src="/js/sorttable.js"></script>
  <style>
  /* Sortable tables */
  table.sortable {
    width: 100%;
    border: 0;
    table-layout:fixed;
    word-wrap:break-word;
    border-collapse:collapse;
  }

  table.sortable thead {
      background-color:#eee;
      color:#666666;
      font-weight: bold;
      cursor: default;
  }
  </style>
  <p></p>
  <table class="sortable" border="1" width=100%>
    <colgroup>
      <col style="width:20%">
      <col style="width:40%">
      <col style="width:10%">
      <col style="width:10%">
    </colgroup>
    <tbody>
      <tr><th>timestamp</th><th>result</th><th>entity count</th><th>complete</th>
        <% @results.each do |x| %>
        <tr>
          <td><%= h x.timestamp_start %> </td>
          <td><a href="/<%=@project_name%>/results/<%=x.id%>"><%= h x.task_name %> on <%= h x.base_entity.to_s %></a> </td>
          <td><%= h x.entities.count %> </td>
          <td><%= x.complete ? "complete" : "incomplete" %></td>
        </tr>
        <% end %>
    </tbody>
  </table>
  <div class="row">
    <div class="col-xs-11">&nbsp;</div>
    <div class="col-xs-1">
      <p><a href="<%=request.path%>/all/cancel">Cancel All</a></p>
    </div>
  </div>
